package com.quasar.hpatient.module.discover;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.quasar.hpatient.R;
import com.quasar.hpatient.module.discover_community.DiscoverCommunityFragment;
import com.quasar.hpatient.module.discover_recommend.DiscoverRecommendFragment;

import lib.quasar.context.BaseApp;

/**
 * description: 发现
 * created by kalu on 2018/4/2 16:12
 */
public class DiscoverAdapter extends FragmentPagerAdapter {

    public DiscoverAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public int getCount() {
        return 2;
    }

    @Override
    public Fragment getItem(int position) {
        return position == 0 ? new DiscoverCommunityFragment() : new DiscoverRecommendFragment();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        Context context = BaseApp.getContext();
        return context.getResources().getString(position == 0 ? R.string.title_community : R.string.title_recommend_information);
    }
}